<?php
/*
$Id: qbi_shipmatch.php,v 2.10 2005/05/08 al Exp $

Quickbooks Import QBI
contribution for osCommerce
ver 2.10 May 8, 2005
(c) 2005 Adam Liberman
www.libermansound.com
info@libermansound.com
Please use the osC forum for support.
Released under the GNU General Public License

    This file is part of Quickbooks Import QBI.

    Quickbooks Import QBI is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    Quickbooks Import QBI is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Quickbooks Import QBI; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/

require('includes/application_top.php');
require(DIR_WS_LANGUAGES . $language . '/qbi_general.php');
// Now read new configuration
require_once(DIR_WS_INCLUDES . 'qbi_version.php');
require_once(DIR_WS_INCLUDES . 'qbi_definitions.php');
require_once(DIR_WS_FUNCTIONS . 'qbi_functions.php');
require_once(DIR_WS_CLASSES . 'qbi_classes.php');
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
<link rel="stylesheet" type="text/css" href="includes/qbi_styles.css">
<script type="text/javascript" src="includes/general.js"></script>
<script type="text/javascript" src="includes/menu.js"></script>
<script type="text/javascript"><!--
popUpWin=0;

function popUpWindow(URLStr, left, top, width, height){

  if(popUpWin)

  {

    if(!popUpWin.closed) popUpWin.close();

  }

  popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');

}
//--></script>
</head>
<body bgcolor="#FFFFFF">
<div id="spiffycalendar" class="text"></div>
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->

<!-- body //-->
<table border="0" width="100%" cellspacing="2" cellpadding="2">
  <tr>
    <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
    </table></td>
<!-- body_text //-->
    <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
      <tr>
        <td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0">
          <tr>
            <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
            <td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td>
<?php
if (isset($stage) AND $stage=="shipupdate") {
  ship_update($ship_menu);
  echo MATCH_SUCCESS;
}
// Find and update osC shipping methods
ship_methods();
?>
<table class="lists">
<!-- <form action="<?php echo $_SERVER[PHP_SELF]?>" method="post" name="qbi_shipping" id="qbi_shipping"> -->
<?php echo tep_draw_form('qbi_shipping', FILENAME_QBI_SHIPMATCH, tep_get_all_get_params(array('action','qbi_shipping'), 'post', '', 'SSL') . 'stage=shipupdate', 'post', '', 'SSL'); ?>


<input name="stage" id="stage" type="hidden" value="shipupdate" />
<input name="search_page" id="search_page" type="hidden" value="<?php echo $search_page?>" />
<?php
$Query = "SELECT COUNT(*) AS cnt FROM ".TABLE_QBI_SHIPOSC." WHERE language_id='$languages_id'";
$result = tep_db_query($Query) or die(mysql_error());
$row = tep_db_fetch_array($result);
$count = $row['cnt'];
if($count > 0){
  $page = new page_class($count,QBI_PROD_ROWS,10);
  $limit = $page->get_limit();
  $resultqbc = tep_db_query("SELECT * FROM ".TABLE_QBI_SHIPOSC." WHERE language_id='$languages_id' ORDER BY qbi_shiposc_car_text, qbi_shiposc_serv_text ".$limit);
  $hstring = $page->make_head_string(SHIP_TITLE);
  $pstring = $page->make_page_string(); //add the other variables to pass to next page in a similar fashion
  echo "<tr><th colspan='2' class='counter'>$hstring</th></tr>\r\n";
  echo "<tr><td colspan='2'>&nbsp;</td></tr>\r\n";
  echo "<tr><th class='colhead'>".MATCH_OSC."</th><th class='colhead'>".MATCH_QB."</th></tr>\r\n";
  while ($myrowqbc = tep_db_fetch_array($resultqbc)) {
    echo "<tr><td class='oscmodel'>".$myrowqbc["qbi_shiposc_car_text"];
	if (strlen($myrowqbc["qbi_shiposc_serv_text"])>1) {
	  echo " - ".$myrowqbc["qbi_shiposc_serv_text"];
	}
	echo "</td>";
    ship_dropdown($myrowqbc["qbi_shiposc_car_code"],$myrowqbc["qbi_shiposc_serv_code"],$languages_id);
  }
echo "<tr><td colspan=\"2\">&nbsp;</td></tr>\r\n";
echo "<tr><td colspan=\"2\" class='pagelist'>$pstring</td></tr>\r\n";
}
?>
<tr>
 <td>
 <!-- <input name="submit" type="submit" id="submit" value="<?php echo MATCH_BUTTON ?>" /> -->
 <?php echo tep_image_submit('button_module_install.gif', "Match Modules") . '&nbsp;' ;?>
 </td>
</tr>
</table></form>
<!-- body_eof //-->

<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<br>
</body>
